# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html


class JuchaoPipeline(object):
    def process_item(self, item, spider):
        path = "F:/python/juchaonetspider/juchao/jcw_PDF/"
        file = item['name'] + '__' + item['PDF_id'] + '.pdf'
        path += file

        with open(path, 'wb') as fp:
            fp.write(item['PDF_content'])

        return item
